import { defineStore } from 'pinia'
import { generateRouter, setAdminAddRoute } from '@/router/adminLoginRouter.js'
export const routeStore = defineStore('route', {
    state: () => {
        return {
        }
    },
    actions: {
        addRouter() {
            // 生成路由树
            // routerList在登陆成功时获取到，在跳转页面之前存起来
            let find = JSON.parse(window.localStorage.getItem('vue3-vite5-admin-routerList'))
            let routerList = generateRouter(find)
            // 添加路由
            setAdminAddRoute(routerList)
        },
    },
    getters: {},
})